package com.syq.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.syq.mapper.DtsGoodsProductMapper;
import com.syq.pojo.DtsGoodsAttribute;
import com.syq.pojo.DtsGoodsProduct;
import com.syq.service.DtsGoodsProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @ClassName: DtsGoodsProductServiceImpl
 * @Description: TODO
 * @Create by: syq
 * @Date: 2022/7/22 16:01
 */

@Service
@Transactional
public class DtsGoodsProductServiceImpl implements DtsGoodsProductService {

    @Autowired
    private DtsGoodsProductMapper dtsGoodsProductMapper;
    @Override
    public Long findCount() {
        return dtsGoodsProductMapper.selectCount(null);
    }

    @Override
    public List<DtsGoodsProduct> findById(Integer id) {
        return dtsGoodsProductMapper.selectList(new QueryWrapper<DtsGoodsProduct>().eq("goods_id",id));
    }

    @Override
    public void deleteById(Integer id) {
        dtsGoodsProductMapper.delete(new QueryWrapper<DtsGoodsProduct>().eq("goods_id",id));
    }

    @Override
    public void add(DtsGoodsProduct product) {
        dtsGoodsProductMapper.insert(product);
    }
}
